<template>
  <div>
    <el-table
      ref="multipleTable"
      :data="filtData"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <el-table-column
        label="部门"
        width="120">
        <template slot-scope="scope">{{ scope.row.DepartmentName }}</template>
      </el-table-column>
      <el-table-column
        prop="RealName"
        label="姓名"
        width="120">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址"
        show-overflow-tooltip>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  export default {
    name:'RightTable',
    props:{
      RightUser:{
            type:Array,
            required: true
        },
        RightList:{
          type:Array,
          required: true
        },
        RightresetTable:{
            type:Array,
            required: true
        },
        LeftSingleId:{
          type:Number,
          required: true
        }
    },
    data() {
      return {
      
      }
    },
    computed:{
      filtData(){
        if(this.RightresetTable.length!==0){
          console.log(this.RightresetTable)
          return this.RightresetTable
        }else{
          if(this.RightList.length==0){
            return this.RightUser
          }else{
            return this.RightList
          }
        }
      }
    },
    methods: {
      toggleSelection(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
      }
    }
  }
</script>